package cn.xiaolang.function.enum_interface;

/**
 * 接口模拟扩展接口
 *
 * @author fuhw/Dean
 * @date 2019-06-10
 */
public enum BaseOperation implements Operation{

    ADD("+"){
        @Override
        public double apply(double x, double y) {
            return x+y;
        }
    },
    SUB("-"){
        @Override
        public double apply(double x, double y) {
            return x-y;
        }
    };

    private String symbol;

    BaseOperation(String symbol) {
        this.symbol = symbol;
    }

    public static void main(String[] args) {
        System.out.println(BaseOperation.ADD.apply(1,2));
    }
}
